<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8"/>
    <title>首页</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/css/bootstrap.min.css">

</head>
<body>

<#--分页-->
<div class="col-md-12 column">
    <ul class="pagination">
        <#if current lte 1>
            <li class="disabled "><a class="page-link">上一页</a></li>
        <#else>
            <li>
                <a class="page-link" href="/ophiuxProblemAnswer/freemarkerIndex3?current=1&size=${size}&useType=${useType}">首页</a>
            </li>
            <li>
                <a class="page-link" href="/ophiuxProblemAnswer/freemarkerIndex3?current=${current - 1}&size=${size}&useType=${useType}">上一页</a>
            </li>
        </#if>

        <#-- 第一页按钮 -->
        <#if (1 == current)>
            <li class="active"><a class="page-link">1</a></li>
        <#elseif (current<=5)>
            <li><a class="page-link" href="/ophiuxProblemAnswer/freemarkerIndex3?current=1&size=${size}&useType=${useType}">1</a></li>
        </#if>

        <#--总页数<7-->
        <#if (totalPage<7)>
            <#if ((totalPage - 1)>=2)>
                <#list 2..(totalPage - 1) as i>
                    <#if current == i>
                        <li class="active"><a class="page-link">${i}</a></li>
                    <#else>
                        <li><a class="page-link" href="/ophiuxProblemAnswer/freemarkerIndex3?current=${i}&size=${size}&useType=${useType}" >${i}</a></li>
                    </#if>
                </#list>
            </#if>
        <#else><#--总页数>=7-->
        <#--当前页数小于6-->
            <#if (current < 6)>
            <#-- 2到5页 -->
                <#list 2..5 as i>
                    <#if current == i >
                        <li class="active"><a class="page-link">${i}</a></li>
                    <#else>
                        <li><a class="page-link" href="/ophiuxProblemAnswer/freemarkerIndex3?current=${i}&size=${size}&useType=${useType}">${i}</a></li>
                    </#if>
                </#list>
                <#if ((current + 2) <= totalPage)>
                    <li><a class="page-link">...</a></li>
                </#if>
            <#else><#--6页以上-->
            <#-- 总页数 - 当前页 < 5  -->
                <#if ((totalPage - current) < 5)>
                    <#if ((totalPage - 4) > 2)>
                        <li><a class="page-link" >...</a></li>
                    </#if>
                    <#list (totalPage -4)..(totalPage -1) as i>
                        <#if current == i >
                            <li class="active"><a class="page-link">${i}</a></li>
                        <#else>
                            <li><a class="page-link" href="/ophiuxProblemAnswer/freemarkerIndex3?current=${i}&size=${size}&useType=${useType}">${i}</a></li>
                        </#if>
                    </#list>
                <#else><#-- 总页数 - 当前页 >= 5 -->
                    <li><a class="page-link">...</a></li>
                    <#list (current -2)..(current +2) as i>
                        <#if current == i>
                            <li class="active"><a class="page-link">${i}</a></li>
                        <#else>
                            <li><a class="page-link" href="/ophiuxProblemAnswer/freemarkerIndex3?current=${i}&size=${size}&useType=${useType}">${i}</a></li>
                        </#if>
                    </#list>
                    <li><a class="page-link">...</a></li>
                </#if>
            </#if>
        </#if>

        <#-- 最后一页按钮 -->
        <#if (totalPage > 1)>
            <#if totalPage  == current >
                <li class="active"><a class="page-link">${totalPage }</a></li>
            <#else>
                <li><a class="page-link" href="/ophiuxProblemAnswer/freemarkerIndex3?current=${totalPage}&size=${size}&useType=${useType}">${totalPage}</a></li>
            </#if>
        </#if>

        <#--下一页-->
        <#if (current gte totalPage)>
            <li class="disabled "><a class="page-link">下一页</a></li>
        <#else>
            <li>
                <a class="page-link" href="/ophiuxProblemAnswer/freemarkerIndex3?current=${totalPage}&size=${size}&useType=${useType}">尾页</a>
            </li>
            <li>
                <a class="page-link" href="/ophiuxProblemAnswer/freemarkerIndex3?current=${current + 1}&size=${size}&useType=${useType}">下一页</a>
            </li>
        </#if>
    </ul>
</div>

<table class="table table-bordered">
    <tr>
        <td width="100">答题记录id</td>
        <td width="100">患者id</td>
        <td width="100">答题类型</td>
        <td width="100">答题时间</td>
        <#list problemList as problem>
            <td width="100">${problem.problemTitle}</td>
        </#list>
    </tr>
    <#list list as problem>
        <tr style="border: 1px solid black;">
            <td width="100">${problem.answerRecordId}</td>
            <td width="100">${problem.patientId}</td>
            <td width="100">
                <#if problem.useType==1>门诊</#if>
                <#if problem.useType==2>住院</#if>
            </td>
            <td>${problem.createdTime}</td>
            <#list problem.answerList as answer>
                <td  width="100" style="margin-left: 20px;border: 1px solid black;">${answer}</td>
            </#list>
        </tr>
    </#list>
</table>

</body>
</html>